<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<!--
		Charisma v1.0.0

		Copyright 2012 Muhammad Usman
		Licensed under the Apache License v2.0
		http://www.apache.org/licenses/LICENSE-2.0

		http://usman.it
		http://twitter.com/halalit_usman
	-->
<meta charset="utf-8">
<title>友宝后台管理系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
	content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
<meta name="author" content="Muhammad Usman">

<!-- The styles -->
<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

.mustInfo {
	color: red;
}
.canBeNull {
	color: blue;
}
</style>
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
	  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->

<!-- The fav icon -->
<link rel="shortcut icon" href="img/favicon.ico">
<script src="js/jquery-1.7.2.min.js"></script>

</head>

<body>
<jsp:include page="/referencesHtml/jsAndCss.html"></jsp:include>
	<!-- topbar ends -->
	<div class="container-fluid">
		<div class="row-fluid">
			<div id="content" class="span10">
				<!-- content starts -->
				<form class="form-horizontal" action="" method="post" id="form">
					<div class="control-group">
						<label class="control-label" for="typeahead">类型:</label>
						<div class="controls">
							<select id="type" type="text"
								style="width: 280px;">
									<option value="1">主动</option>
									<option value="2">被动</option>
							</select>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="typeahead">问题类型:</label>
						<div class="controls">
							<select id="problemID" type="text"
								style="width: 280px;">
									<option value="1">有空来取</option>
									<option value="2">号码空号</option>
									<option value="3">存错了</option>
									<option value="4">未接电话</option>
									<option value="5">空包</option>
									<option value="6">退件</option>
									<option value="7">没收到短信</option>
							</select>
						</div>
					</div>
					<div class="control-group hide">
						<label class="control-label" for="typeahead">未收到短信原因:</label>
						<div class="controls">
							<textarea id="reason" type="text" style="width: 400px;height: 100px;">请写入原因</textarea>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="typeahead">操作:</label>
						<div class="controls">
							<select id="operate" type="text"
								style="width: 280px;">
									<option value="0">无</option>
									<option value="1">清空箱格</option>
									<option value="2">远程开箱</option>
									<option value="3">系统补发短信</option>
									<option value="4">锁定箱格</option>
							</select>
						</div>
					</div>
					<div class="control-group hide">
						<label class="control-label" for="typeahead">正确的用户手机号码:</label>
						<div class="controls">
							<input id="newPhone" type="text" maxlength="11" style="width: 280px;"/>
							<span style="color:blue;">（可根据需要修改）</span>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="typeahead">滞留等级:</label>
						<div class="controls">
							<select id="detained" type="text"
								style="width: 280px;">
									<option value="0">无滞留</option>
									<option value="1">滞留一级</option>
									<option value="2">滞留二级</option>
									<option value="3">滞留三级</option>
							</select>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="typeahead">备注:</label>
						<div class="controls">
							<textarea id="comment" type="text" style="width: 400px;height: 100px;"></textarea>
						</div>
					</div>
					<div class="form-actions">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<button type="button" class="btn btn-primary" id="subBtn" packageID="${packageID}">确定</button>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<button class="btn btn-success xubox_close" type="button" id="cancel">取消</button>
					</div>
				</form>
				<!-- content ends -->
			</div>
			<!--/#content.span10-->
		</div>
		<!--/fluid-row-->
		<hr>
	</div>
	<script src="js/layer/layer.js"></script>
	<script type="text/javascript">
	$(function() {
		var status = "${status}";
		var packageID = "${packageID}";
		if(status==5||status==1){
			$("#operate").parent().parent().hide();
		}
		$.post("package!getUserPhoneByParcelID?&packageID="+packageID,function(v){
			$("#newPhone").val(v);
		});
	});
		$("#type").live("change", function() {
			if($("#type").val()==1){
				$("#problemID").html("<option value='1'>有空来取</option><option value='2'>号码空号</option><option value='3'>存错了</option><option value='4'>未接电话</option><option value='5'>空包</option><option value='6'>退件</option><option value='7'>没收到短信</option>");
			}
			if($("#type").val()==2){
				$("#problemID").html("<option value='8'>门没打开</option><option value='9'>取件码失效</option><option value='3'>存错了</option><option value='10'>系统维护中</option><option value='11'>疑似丢件</option><option value='7'>没收到短信</option><option value='12'>手机号码输错</option>");
			}
		});
		$("#problemID").live("change", function() {
			$("#reason").html("请写入原因");
			if($("#problemID").val()==7){
				$("#reason").parent().parent().show();
			}else{
				$("#reason").parent().parent().hide();
			}
		});
		$("#operate").live("change", function() {
			if($("#operate").val()==3){
				$("#newPhone").parent().parent().show();
			}else{
				$("#newPhone").parent().parent().hide();
			}
		});
		$("#cancel").live("click", function() {
			/**parent.useMe("调用父窗口函数");**/
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		});
		$("#subBtn").live(
				"click",
				function() {
					//console.log("comment============"+$("textarea").val());
					if($("#operate").val()==3&&!$("#newPhone").val().match(/^(13[0-9]|15[0|3|6|7|8|9]|18[2|6|8|9])\d{8}$/)){
						alert("手机号码格式错误！！");
					}else{
						parent.sign($("#newPhone").val(),$("#problemID").val(),$("#reason").val(),$("#operate").val(),$("#detained").val(),$("#comment").val(),$(this).attr("packageID"));
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					}
				});
	</script>
</body>
</html>
